package cn.kshost.zqyg.utils;

import cn.kshost.zqyg.model.entity.system.SysUser;
import cn.kshost.zqyg.model.entity.user.UserInfo;

public class AuthContextUtil {
    private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();
    private static final ThreadLocal<UserInfo> userInfoThreadLocal = new ThreadLocal<>();


    //设置值
   public static void setValue(SysUser user) {
        threadLocal.set(user);
    }

    //获取值
    public static  SysUser getValue() {
        return threadLocal.get();
    }

    //删除值
    public static  void removeVale(){
       threadLocal.remove();
    }

    public static void setUserInfoValue(UserInfo userInfo) {
       userInfoThreadLocal.set(userInfo);
    }
    public static UserInfo getUserInfoValue() {
       return userInfoThreadLocal.get();
    }
    public static void removeUserInfoValue() {
       userInfoThreadLocal.remove();
    }

}
